package com.skyhigh.web.webservice.persistence;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.skyhigh.web.webservice.domain.Usuario;
import com.skyhigh.web.webservice.exceptions.QueryException;
import com.skyhigh.web.webservice.exceptions.RecordNotFoundException;


@Repository
@Transactional
@SuppressWarnings("unchecked")
public interface GenericDAO {
	
	public int count(Class entity);
    
	public <T> T get(Class<T> entity, Serializable id);

    public <T> List<T> getAll(Class<T> entity);

    public <T> T load(Class<T> entity, Serializable id);
    
    public Object save(Object object);

    public void update(Object object);

    public void delete(Object object);
    
    public void deleteById(Class entity, Serializable id) throws RecordNotFoundException;
    
    public void deleteAll(Class entity);
    
    public void deleteAll(List entities);
    
    public boolean exists(Object entity);
    
    public <T> List<T> find(String query);
    
    public <T> List<T> find(String query, Object id);
    
    public <T> List<T> find(String query, Object[] param);
    
    public <T> T findFirst(String query);
    
    public List execute(Query query) throws QueryException;    

    public int executeUpdate(Query query) throws QueryException;
    
    public int executeDelete(Query query) throws QueryException;
    
    public Map executeProcedure(Query query) throws QueryException; 

    public boolean iniciarSesion(Usuario entity, String password);
}
